package com.macro.mall.portal.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.macro.mall.portal.dao.TransferMapper;
import com.macro.mall.portal.domain.Transfer;
import com.macro.mall.portal.service.IAppraisalService;
import com.macro.mall.portal.dao.AppraisalMapper;
import com.macro.mall.portal.domain.Appraisal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 估价表 服务实现类
 * </p>
 *
 * @author db
 * @since 2021-07-04
 */
@Service
public class AppraisalServiceImpl extends ServiceImpl<AppraisalMapper, Appraisal> implements IAppraisalService {

    @Autowired
    private AppraisalMapper appraisalMapper;

    @Override
    public void addOne(Appraisal appraisal) {
        appraisalMapper.insert(appraisal);
    }

    @Override
    public IPage<Appraisal> selectBy(String openid, Integer current, Integer size) {
        QueryWrapper<Appraisal> wrapper = new QueryWrapper<>();
        wrapper.eq("open_id", openid);
        wrapper.orderByDesc("create_time");
        Page<Appraisal> userPage = new Page<>(current, size);
        IPage<Appraisal> appraisalIPage = appraisalMapper.selectPage(userPage, wrapper);
        return appraisalIPage;
    }
}
